// pages/video/video.js
import request from '../../utils/request'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    videoGroupList:[], //导航标签数据
    navId: '', // 导航的标识
    videoList:[],//视频列表数据
    videoId:'',//视频id标识
    videoUpdateTime:[],//记录video播放的时长
    isTriggered:false, //标识下拉刷新是否被触发
  },

  /**
   * 生命周期函数--监听页面加载
   */
   onLoad: function (options) {
    // 获取导航数据
    this.getVideoGroupListData();
   
  },

  //获取导航数据
  async getVideoGroupListData(){
    let videoGroupListData = await request('/video/group/list');
    this.setData({
      videoGroupList:videoGroupListData.data.slice(0,14),
      //导航下标默认处于第一位
      navId:videoGroupListData.data[0].id
    })
    //获取视频列表数据
    this.getVideoList(this.data.navId);
  },

  //获取视频列表数据
  async getVideoList(id) {
    if (!id){
      return;
    } 
    // console.log(this.data.videoGroupList);
    console.log('id:',id);
    let result = await request('/video/group', { id })
    console.log('resultgh:',result);
    let videoListData
    if(result.code!=200){
        videoListData=[]
    }else{
        videoListData=await Promise.all(result.datas.map(async item=>{
            item.id=item.data.vid
            let result=await request('/video/url',{id:item.id})
            // console.log(result,'++++');
            item.url=result.urls[0].url
            return item
        }))
    }
    // 关闭消息提示框
    wx.hideLoading();
    this.setData({
      videoList:videoListData,
      isTriggered:false //关闭下拉刷新
    })
  },

  
  //点击切换导航的回调
  changeNav(event){
    let navId = event.currentTarget.id;
    this.setData({
      navId,
      videoList:[]
    })
    //显示正在加载
    wx.showLoading({
      title: '正在加载',
    })

    //动态获取当前导航对应的视频数据
    this.getVideoList(this.data.navId)
  },

  //点击播放/继续播放的回调
  handlePlay(event){
     /*
      问题： 多个视频同时播放的问题
    * 需求：
    *   1. 在点击播放的事件中需要找到上一个播放的视频
    *   2. 在播放新的视频之前关闭上一个正在播放的视频
    * 关键：
    *   1. 如何找到上一个视频的实例对象
    *   2. 如何确认点击播放的视频和正在播放的视频不是同一个视频
    * 单例模式：
    *   1. 需要创建多个对象的场景下，通过一个变量接收，始终保持只有一个对象，
    *   2. 节省内存空间
    * */
   let vid = event.currentTarget.id
   //关闭上一个播放的视频
  //  this.vid !== vid && this.videoContext && this.videoContext.stop();
  //  this.vid = vid

   //更新data中videoId的状态数据
    this.setData({
      videoId:vid
    })

   //创建控制video标签的实例对象
   this.videoContext = wx.createVideoContext(vid);
  // 判断当前的视频之前是否播放过，是否有播放记录, 如果有，跳转至指定的播放位置
  let {videoUpdateTime} = this.data;
  let videoItem = videoUpdateTime.find(item => item.vid === vid);
  if (videoItem) {
    this.videoContext.seek(videoItem.currentTime);
  }
  //  this.videoContext.play();

  
  },

  //监听视频播放进度的回调
  handleTimeUpdate(event){
    // console.log(event);
    let videoTimeObj = {vid: event.currentTarget.id, currentTime:event.detail.currentTime};
    let {videoUpdateTime} = this.data;
    /*
    * 思路： 判断记录播放时长的videoUpdateTime数组中是否有当前视频的播放记录
    *   1. 如果有，在原有的播放记录中修改播放时间为当前的播放时间
    *   2. 如果没有，需要在数组中添加当前视频的播放对象
    *
    * */
    let videoItem = videoUpdateTime.find(item => item.vid === videoTimeObj.vid);
    if(videoItem){
      videoItem.currentTime = videoTimeObj.currentTime;
    }else{
      videoUpdateTime.push(videoTimeObj);
    }
    //更新videoUpdateTime的状态
    this.setData({
      videoUpdateTime
    })
  },

  //视频播放结束调用的回调
  handleEnded(event){
    // console.log('播放结束');
    //移除记录播放时长数组中的对象
    let {videoUpdateTime} = this.data;
  
    videoUpdateTime.splice(videoUpdateTime.findIndex(item => item.vid === event.currentTarget.id),1);
    this.setData({
      videoUpdateTime
    })
  },

  // 下拉刷新的回调
  handleRefresher(){
    console.log('下拉刷新');
    //再次发请求获取视频数据
    this.getVideoList(this.data.navId);
  },

  //自定义上拉触底的回调 scroll-view
  handleToLower(){
    console.log('scroll-view上拉触底');
    // 数据分页： 1. 后端分页， 2. 前端分页
    console.log('发送请求 || 在前端截取最新的数据 追加到视频列表的后方');
    console.log('网易云音乐暂时没有提供分页的api');
     // 模拟数据
     let newVideoList =[
      {
          "type": 1,
          "displayed": false,
          "alg": "onlineHotGroup",
          "extAlg": null,
          "data": {
              "alg": "onlineHotGroup",
              "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
              "threadId": "R_VI_62_FB44E4EB16B26749A88777BD45EA9702",
              "coverUrl": "https://p1.music.126.net/BpBbGIUdmaWFrmAh41F7-A==/109951163573351359.jpg",
              "height": 360,
              "width": 654,
              "title": "那些经典的欧美情歌：Take Me To Your Heart",
              "description": "那些经典的欧美情歌：Michael Learns To Rock - Take Me To Your Heart",
              "commentCount": 19,
              "shareCount": 144,
              "resolutions": [
                  {
                      "resolution": 240,
                      "size": 15210033
                  }
              ],
              "creator": {
                  "defaultAvatar": false,
                  "province": 450000,
                  "authStatus": 0,
                  "followed": false,
                  "avatarUrl": "http://p1.music.126.net/lVTaNtFdNVh2HhD0ORhAaA==/109951163601870551.jpg",
                  "accountStatus": 0,
                  "gender": 1,
                  "city": 450100,
                  "birthday": 692121600000,
                  "userId": 255096203,
                  "userType": 0,
                  "nickname": "John_分享",
                  "signature": "用音乐点缀怒放的生命。",
                  "description": "",
                  "detailDescription": "",
                  "avatarImgId": 109951163601870540,
                  "backgroundImgId": 109951163285208750,
                  "backgroundUrl": "http://p1.music.126.net/lpOxaFlD6ems9969KHltcg==/109951163285208749.jpg",
                  "authority": 0,
                  "mutual": false,
                  "expertTags": null,
                  "experts": {
                      "1": "音乐视频达人"
                  },
                  "djStatus": 10,
                  "vipType": 0,
                  "remarkName": null,
                  "avatarImgIdStr": "109951163601870551",
                  "backgroundImgIdStr": "109951163285208749"
              },
              "urlInfo": null,
              "videoGroup": [
                  {
                      "id": 58100,
                      "name": "现场",
                      "alg": null
                  },
                  {
                      "id": 57106,
                      "name": "欧美现场",
                      "alg": null
                  },
                  {
                      "id": 57108,
                      "name": "流行现场",
                      "alg": null
                  },
                  {
                      "id": 57110,
                      "name": "饭拍现场",
                      "alg": null
                  },
                  {
                      "id": 1100,
                      "name": "音乐现场",
                      "alg": null
                  },
                  {
                      "id": 5100,
                      "name": "音乐",
                      "alg": null
                  }
              ],
              "previewUrl": "http://vodkgeyttp9.vod.126.net/vodkgeyttp8/preview_1515699170_x3aPFGNw.webp?wsSecret=bce7b931a041e1d942f8dbed4c891738&wsTime=1677155205",
              "previewDurationms": 4000,
              "hasRelatedGameAd": false,
              "markTypes": [
                  109
              ],
              "relateSong": [
                  {
                      "name": "Take Me To Your Heart",
                      "id": 4173190,
                      "pst": 0,
                      "t": 0,
                      "ar": [
                          {
                              "id": 96269,
                              "name": "Michael Learns To Rock",
                              "tns": [],
                              "alias": []
                          }
                      ],
                      "alia": [],
                      "pop": 100,
                      "st": 0,
                      "rt": "600902000000809398",
                      "fee": 1,
                      "v": 35,
                      "crbt": null,
                      "cf": "",
                      "al": {
                          "id": 421938,
                          "name": "Take Me to Your Heart",
                          "picUrl": "http://p4.music.126.net/Vi3HrimsCpdrn1s6vWQxYQ==/19141397928160786.jpg",
                          "tns": [],
                          "pic_str": "19141397928160786",
                          "pic": 19141397928160784
                      },
                      "dt": 239000,
                      "h": {
                          "br": 320000,
                          "fid": 0,
                          "size": 9562949,
                          "vd": -59217
                      },
                      "m": {
                          "br": 192000,
                          "fid": 0,
                          "size": 5737786,
                          "vd": -56675
                      },
                      "l": {
                          "br": 128000,
                          "fid": 0,
                          "size": 3825205,
                          "vd": -55138
                      },
                      "a": null,
                      "cd": "1",
                      "no": 3,
                      "rtUrl": null,
                      "ftype": 0,
                      "rtUrls": [],
                      "djId": 0,
                      "copyright": 1,
                      "s_id": 0,
                      "rtype": 0,
                      "rurl": null,
                      "mst": 9,
                      "cp": 14002,
                      "mv": 5308235,
                      "publishTime": 1075910400007,
                      "privilege": {
                          "id": 4173190,
                          "fee": 1,
                          "payed": 0,
                          "st": 0,
                          "pl": 0,
                          "dl": 0,
                          "sp": 0,
                          "cp": 0,
                          "subp": 0,
                          "cs": false,
                          "maxbr": 320000,
                          "fl": 0,
                          "toast": false,
                          "flag": 260,
                          "preSell": false
                      }
                  }
              ],
              "relatedInfo": null,
              "videoUserLiveInfo": null,
              "vid": "FB44E4EB16B26749A88777BD45EA9702",
              "durationms": 244762,
              "playTime": 94190,
              "praisedCount": 318,
              "praised": false,
              "subscribed": false
          }
      },
      {
          "type": 1,
          "displayed": false,
          "alg": "onlineHotGroup",
          "extAlg": null,
          "data": {
              "alg": "onlineHotGroup",
              "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
              "threadId": "R_VI_62_16600F4D96CC1AED41D5F870F33BD050",
              "coverUrl": "https://p2.music.126.net/Ao8O_1QL8lreUkh2VTlxEQ==/109951163438170135.jpg",
              "height": 720,
              "width": 1280,
              "title": "Eminem-Mockingbird-New York City",
              "description": "Mockingbird叛逆是给世界的，温柔全是给女儿的。",
              "commentCount": 5,
              "shareCount": 27,
              "resolutions": [
                  {
                      "resolution": 240,
                      "size": 13376511
                  },
                  {
                      "resolution": 480,
                      "size": 20959937
                  },
                  {
                      "resolution": 720,
                      "size": 29077343
                  }
              ],
              "creator": {
                  "defaultAvatar": false,
                  "province": 110000,
                  "authStatus": 0,
                  "followed": false,
                  "avatarUrl": "http://p1.music.126.net/KQYslSH26t337VbuSstbTQ==/109951163117881906.jpg",
                  "accountStatus": 0,
                  "gender": 2,
                  "city": 110101,
                  "birthday": 826300800000,
                  "userId": 1345107052,
                  "userType": 0,
                  "nickname": "壹颗橙子阿",
                  "signature": "是一颗喜欢音乐现场的橙子阿",
                  "description": "",
                  "detailDescription": "",
                  "avatarImgId": 109951163117881900,
                  "backgroundImgId": 109951162868126480,
                  "backgroundUrl": "http://p1.music.126.net/_f8R60U9mZ42sSNvdPn2sQ==/109951162868126486.jpg",
                  "authority": 0,
                  "mutual": false,
                  "expertTags": null,
                  "experts": {
                      "1": "音乐视频达人"
                  },
                  "djStatus": 0,
                  "vipType": 11,
                  "remarkName": null,
                  "avatarImgIdStr": "109951163117881906",
                  "backgroundImgIdStr": "109951162868126486"
              },
              "urlInfo": null,
              "videoGroup": [
                  {
                      "id": 58100,
                      "name": "现场",
                      "alg": null
                  },
                  {
                      "id": 57106,
                      "name": "欧美现场",
                      "alg": null
                  },
                  {
                      "id": 57108,
                      "name": "流行现场",
                      "alg": null
                  },
                  {
                      "id": 59108,
                      "name": "巡演现场",
                      "alg": null
                  },
                  {
                      "id": 1100,
                      "name": "音乐现场",
                      "alg": null
                  },
                  {
                      "id": 5100,
                      "name": "音乐",
                      "alg": null
                  },
                  {
                      "id": 15198,
                      "name": "Eminem",
                      "alg": null
                  }
              ],
              "previewUrl": "http://vodkgeyttp9.vod.126.net/vodkgeyttp8/preview_1838570464_GBiWIv6p.webp?wsSecret=885e25686f9574ae4c887bcec5f85a16&wsTime=1677155205",
              "previewDurationms": 4000,
              "hasRelatedGameAd": false,
              "markTypes": null,
              "relateSong": [
                  {
                      "name": "Mockingbird",
                      "id": 5186979,
                      "pst": 0,
                      "t": 0,
                      "ar": [
                          {
                              "id": 32665,
                              "name": "Eminem",
                              "tns": [],
                              "alias": []
                          }
                      ],
                      "alia": [],
                      "pop": 95,
                      "st": 0,
                      "rt": "",
                      "fee": 8,
                      "v": 151,
                      "crbt": null,
                      "cf": "",
                      "al": {
                          "id": 507952,
                          "name": "Now That's What I Call Music! 19",
                          "picUrl": "http://p4.music.126.net/kL_3nw-JyQbBgv2upYkYQQ==/2479398720656042.jpg",
                          "tns": [],
                          "pic": 2479398720656042
                      },
                      "dt": 250000,
                      "h": {
                          "br": 320000,
                          "fid": 0,
                          "size": 10008210,
                          "vd": -52030
                      },
                      "m": {
                          "br": 192000,
                          "fid": 0,
                          "size": 6004997,
                          "vd": -52030
                      },
                      "l": {
                          "br": 128000,
                          "fid": 0,
                          "size": 4003391,
                          "vd": -52030
                      },
                      "a": null,
                      "cd": "1",
                      "no": 6,
                      "rtUrl": null,
                      "ftype": 0,
                      "rtUrls": [],
                      "djId": 0,
                      "copyright": 1,
                      "s_id": 0,
                      "rtype": 0,
                      "rurl": null,
                      "mst": 9,
                      "cp": 1416089,
                      "mv": 37124,
                      "publishTime": 1114876800007,
                      "privilege": {
                          "id": 5186979,
                          "fee": 8,
                          "payed": 0,
                          "st": 0,
                          "pl": 128000,
                          "dl": 0,
                          "sp": 7,
                          "cp": 1,
                          "subp": 1,
                          "cs": false,
                          "maxbr": 999000,
                          "fl": 128000,
                          "toast": false,
                          "flag": 256,
                          "preSell": false
                      }
                  }
              ],
              "relatedInfo": null,
              "videoUserLiveInfo": null,
              "vid": "16600F4D96CC1AED41D5F870F33BD050",
              "durationms": 140949,
              "playTime": 29722,
              "praisedCount": 225,
              "praised": false,
              "subscribed": false
          }
      },
      {
          "type": 1,
          "displayed": false,
          "alg": "onlineHotGroup",
          "extAlg": null,
          "data": {
              "alg": "onlineHotGroup",
              "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
              "threadId": "R_VI_62_D50ED1546346230922CF5655E601C05A",
              "coverUrl": "https://p2.music.126.net/XmFwcuxlRy1TwQEJopy0ZA==/109951163855049045.jpg",
              "height": 720,
              "width": 1280,
              "title": "【法国好声音】让她来点燃你的心",
              "description": "谢谢支持，欢迎关注",
              "commentCount": 57,
              "shareCount": 103,
              "resolutions": [
                  {
                      "resolution": 240,
                      "size": 17377036
                  },
                  {
                      "resolution": 480,
                      "size": 28679558
                  },
                  {
                      "resolution": 720,
                      "size": 34609194
                  }
              ],
              "creator": {
                  "defaultAvatar": false,
                  "province": 1000000,
                  "authStatus": 0,
                  "followed": false,
                  "avatarUrl": "http://p1.music.126.net/S5tKkYOYn6Q9Ix3FI8u_zw==/109951165599496609.jpg",
                  "accountStatus": 0,
                  "gender": 1,
                  "city": 1010000,
                  "birthday": 654067109519,
                  "userId": 1637657489,
                  "userType": 0,
                  "nickname": "今夜风不凉",
                  "signature": "",
                  "description": "",
                  "detailDescription": "",
                  "avatarImgId": 109951165599496600,
                  "backgroundImgId": 109951165005282290,
                  "backgroundUrl": "http://p1.music.126.net/e5cjsm1fEd_8v7sGtfvEjw==/109951165005282291.jpg",
                  "authority": 0,
                  "mutual": false,
                  "expertTags": null,
                  "experts": null,
                  "djStatus": 0,
                  "vipType": 0,
                  "remarkName": null,
                  "avatarImgIdStr": "109951165599496609",
                  "backgroundImgIdStr": "109951165005282291"
              },
              "urlInfo": null,
              "videoGroup": [
                  {
                      "id": 58100,
                      "name": "现场",
                      "alg": null
                  },
                  {
                      "id": 1100,
                      "name": "音乐现场",
                      "alg": null
                  },
                  {
                      "id": 5100,
                      "name": "音乐",
                      "alg": null
                  },
                  {
                      "id": 4101,
                      "name": "娱乐",
                      "alg": null
                  },
                  {
                      "id": 3101,
                      "name": "综艺",
                      "alg": null
                  },
                  {
                      "id": 75122,
                      "name": "欧美综艺",
                      "alg": null
                  },
                  {
                      "id": 76108,
                      "name": "综艺片段",
                      "alg": null
                  }
              ],
              "previewUrl": "http://vodkgeyttp9.vod.126.net/vodkgeyttp8/preview_2309748391_5q2b0LGH.webp?wsSecret=c64952cdce4d7cd8a0d549ace52baf64&wsTime=1677155205",
              "previewDurationms": 4000,
              "hasRelatedGameAd": false,
              "markTypes": null,
              "relateSong": [
                  {
                      "name": "Rude Boy",
                      "id": 3313757,
                      "pst": 0,
                      "t": 0,
                      "ar": [
                          {
                              "id": 72724,
                              "name": "Rihanna",
                              "tns": [],
                              "alias": []
                          }
                      ],
                      "alia": [],
                      "pop": 100,
                      "st": 0,
                      "rt": "600902000008162285",
                      "fee": 1,
                      "v": 27,
                      "crbt": null,
                      "cf": "",
                      "al": {
                          "id": 335643,
                          "name": "Rude Boy",
                          "picUrl": "http://p4.music.126.net/tjsruaij5ELq6RECZeSv_Q==/18684001092760773.jpg",
                          "tns": [],
                          "pic_str": "18684001092760773",
                          "pic": 18684001092760772
                      },
                      "dt": 223000,
                      "h": {
                          "br": 320000,
                          "fid": 0,
                          "size": 8938192,
                          "vd": -60409
                      },
                      "m": {
                          "br": 192000,
                          "fid": 0,
                          "size": 5362969,
                          "vd": -60409
                      },
                      "l": {
                          "br": 128000,
                          "fid": 0,
                          "size": 3575357,
                          "vd": -60409
                      },
                      "a": null,
                      "cd": "1",
                      "no": 1,
                      "rtUrl": null,
                      "ftype": 0,
                      "rtUrls": [],
                      "djId": 0,
                      "copyright": 1,
                      "s_id": 0,
                      "rtype": 0,
                      "rurl": null,
                      "mst": 9,
                      "cp": 7003,
                      "mv": 476235,
                      "publishTime": 1265644800000,
                      "privilege": {
                          "id": 3313757,
                          "fee": 1,
                          "payed": 0,
                          "st": 0,
                          "pl": 0,
                          "dl": 0,
                          "sp": 0,
                          "cp": 0,
                          "subp": 0,
                          "cs": false,
                          "maxbr": 999000,
                          "fl": 0,
                          "toast": false,
                          "flag": 260,
                          "preSell": false
                      }
                  }
              ],
              "relatedInfo": null,
              "videoUserLiveInfo": null,
              "vid": "D50ED1546346230922CF5655E601C05A",
              "durationms": 143964,
              "playTime": 190485,
              "praisedCount": 815,
              "praised": false,
              "subscribed": false
          }
      },
      {
          "type": 1,
          "displayed": false,
          "alg": "onlineHotGroup",
          "extAlg": null,
          "data": {
              "alg": "onlineHotGroup",
              "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
              "threadId": "R_VI_62_7E41AF81387B353C763C5514BDE5BF72",
              "coverUrl": "https://p1.music.126.net/_M9n7Into_NePz_IqnqGcA==/109951164034175725.jpg",
              "height": 1080,
              "width": 1920,
              "title": "Maroon 5 现场版《Maps》骚当磁性嗓音超常发挥！",
              "description": "Maroon 5 现场版《Maps》骚当磁性嗓音超常发挥！",
              "commentCount": 65,
              "shareCount": 87,
              "resolutions": [
                  {
                      "resolution": 240,
                      "size": 21617516
                  },
                  {
                      "resolution": 480,
                      "size": 36681110
                  },
                  {
                      "resolution": 720,
                      "size": 53193562
                  },
                  {
                      "resolution": 1080,
                      "size": 83356914
                  }
              ],
              "creator": {
                  "defaultAvatar": false,
                  "province": 1000000,
                  "authStatus": 0,
                  "followed": false,
                  "avatarUrl": "http://p1.music.126.net/VIn97149XgPVlhoK0ynlWg==/109951166123418792.jpg",
                  "accountStatus": 0,
                  "gender": 1,
                  "city": 1004400,
                  "birthday": 966873600000,
                  "userId": 337294427,
                  "userType": 0,
                  "nickname": "ins潮流音乐",
                  "signature": "分享好看的音乐视频，欢迎关注！",
                  "description": "",
                  "detailDescription": "",
                  "avatarImgId": 109951166123418780,
                  "backgroundImgId": 109951164173160200,
                  "backgroundUrl": "http://p1.music.126.net/SzdIQPN7aEpSsebgtsofLw==/109951164173160187.jpg",
                  "authority": 0,
                  "mutual": false,
                  "expertTags": null,
                  "experts": {
                      "1": "音乐视频达人"
                  },
                  "djStatus": 10,
                  "vipType": 0,
                  "remarkName": null,
                  "avatarImgIdStr": "109951166123418792",
                  "backgroundImgIdStr": "109951164173160187"
              },
              "urlInfo": null,
              "videoGroup": [
                  {
                      "id": 58100,
                      "name": "现场",
                      "alg": null
                  },
                  {
                      "id": 9102,
                      "name": "演唱会",
                      "alg": null
                  },
                  {
                      "id": 57106,
                      "name": "欧美现场",
                      "alg": null
                  },
                  {
                      "id": 57108,
                      "name": "流行现场",
                      "alg": null
                  },
                  {
                      "id": 1100,
                      "name": "音乐现场",
                      "alg": null
                  },
                  {
                      "id": 5100,
                      "name": "音乐",
                      "alg": null
                  },
                  {
                      "id": 23135,
                      "name": "Maroon 5",
                      "alg": null
                  }
              ],
              "previewUrl": "http://vodkgeyttp9.vod.126.net/vodkgeyttp8/preview_2472174822_6n05cntn.webp?wsSecret=934f2d23f11e14628feec6ed4bf0094f&wsTime=1677155205",
              "previewDurationms": 4000,
              "hasRelatedGameAd": false,
              "markTypes": null,
              "relateSong": [
                  {
                      "name": "Maps",
                      "id": 28661564,
                      "pst": 0,
                      "t": 0,
                      "ar": [
                          {
                              "id": 96266,
                              "name": "Maroon 5",
                              "tns": [],
                              "alias": []
                          }
                      ],
                      "alia": [],
                      "pop": 100,
                      "st": 0,
                      "rt": null,
                      "fee": 1,
                      "v": 54,
                      "crbt": null,
                      "cf": "",
                      "al": {
                          "id": 2866276,
                          "name": "Maps",
                          "picUrl": "http://p3.music.126.net/OC3XXrblVQPgXrkZyLaPow==/3394192437682072.jpg",
                          "tns": [],
                          "pic": 3394192437682072
                      },
                      "dt": 189000,
                      "h": {
                          "br": 320000,
                          "fid": 0,
                          "size": 7596547,
                          "vd": -56970
                      },
                      "m": {
                          "br": 192000,
                          "fid": 0,
                          "size": 4557984,
                          "vd": -56970
                      },
                      "l": {
                          "br": 128000,
                          "fid": 0,
                          "size": 3038702,
                          "vd": -56970
                      },
                      "a": null,
                      "cd": "1",
                      "no": 1,
                      "rtUrl": null,
                      "ftype": 0,
                      "rtUrls": [],
                      "djId": 0,
                      "copyright": 2,
                      "s_id": 0,
                      "rtype": 0,
                      "rurl": null,
                      "mst": 9,
                      "cp": 7003,
                      "mv": 285043,
                      "publishTime": 1402848000000,
                      "privilege": {
                          "id": 28661564,
                          "fee": 1,
                          "payed": 0,
                          "st": 0,
                          "pl": 0,
                          "dl": 0,
                          "sp": 0,
                          "cp": 0,
                          "subp": 0,
                          "cs": false,
                          "maxbr": 999000,
                          "fl": 0,
                          "toast": false,
                          "flag": 260,
                          "preSell": false
                      }
                  }
              ],
              "relatedInfo": null,
              "videoUserLiveInfo": null,
              "vid": "7E41AF81387B353C763C5514BDE5BF72",
              "durationms": 213903,
              "playTime": 250737,
              "praisedCount": 1379,
              "praised": false,
              "subscribed": false
          }
      },
      {
          "type": 1,
          "displayed": false,
          "alg": "onlineHotGroup",
          "extAlg": null,
          "data": {
              "alg": "onlineHotGroup",
              "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
              "threadId": "R_VI_62_4A378F3FF92F2D98C41C14B676276533",
              "coverUrl": "https://p1.music.126.net/myCvcqNd1kw5NCY07SOLPA==/109951163867848651.jpg",
              "height": 1080,
              "width": 1920,
              "title": "2018 BLACKPINK ARENA TOUR 演唱会《STAY》",
              "description": null,
              "commentCount": 70,
              "shareCount": 86,
              "resolutions": [
                  {
                      "resolution": 240,
                      "size": 17611938
                  },
                  {
                      "resolution": 480,
                      "size": 31098677
                  },
                  {
                      "resolution": 720,
                      "size": 46837078
                  },
                  {
                      "resolution": 1080,
                      "size": 83449541
                  }
              ],
              "creator": {
                  "defaultAvatar": false,
                  "province": 140000,
                  "authStatus": 0,
                  "followed": false,
                  "avatarUrl": "http://p1.music.126.net/9pDgFT95_2-vitEOHBo7-A==/109951163654640261.jpg",
                  "accountStatus": 0,
                  "gender": 1,
                  "city": 140100,
                  "birthday": -2209017600000,
                  "userId": 17628423,
                  "userType": 0,
                  "nickname": "Air刘",
                  "signature": "",
                  "description": "",
                  "detailDescription": "",
                  "avatarImgId": 109951163654640260,
                  "backgroundImgId": 2002210674180204,
                  "backgroundUrl": "http://p1.music.126.net/5L9yqWa_UnlHtlp7li5PAg==/2002210674180204.jpg",
                  "authority": 0,
                  "mutual": false,
                  "expertTags": null,
                  "experts": {
                      "1": "音乐视频达人"
                  },
                  "djStatus": 0,
                  "vipType": 0,
                  "remarkName": null,
                  "avatarImgIdStr": "109951163654640261",
                  "backgroundImgIdStr": "2002210674180204"
              },
              "urlInfo": null,
              "videoGroup": [
                  {
                      "id": 58100,
                      "name": "现场",
                      "alg": null
                  },
                  {
                      "id": 1101,
                      "name": "舞蹈",
                      "alg": null
                  },
                  {
                      "id": 57107,
                      "name": "韩语现场",
                      "alg": null
                  },
                  {
                      "id": 57108,
                      "name": "流行现场",
                      "alg": null
                  },
                  {
                      "id": 59108,
                      "name": "巡演现场",
                      "alg": null
                  },
                  {
                      "id": 1100,
                      "name": "音乐现场",
                      "alg": null
                  },
                  {
                      "id": 5100,
                      "name": "音乐",
                      "alg": null
                  },
                  {
                      "id": 92105,
                      "name": "BLACKPINK",
                      "alg": null
                  }
              ],
              "previewUrl": "http://vodkgeyttp9.vod.126.net/vodkgeyttp8/preview_2320249870_5U40w7z9.webp?wsSecret=879a332d48f81849dfa5cb647da27986&wsTime=1677155205",
              "previewDurationms": 4000,
              "hasRelatedGameAd": false,
              "markTypes": null,
              "relateSong": [
                  {
                      "name": "STAY",
                      "id": 1325711421,
                      "pst": 0,
                      "t": 0,
                      "ar": [
                          {
                              "id": 12068017,
                              "name": "BLACKPINK",
                              "tns": [],
                              "alias": []
                          }
                      ],
                      "alia": [],
                      "pop": 100,
                      "st": 0,
                      "rt": null,
                      "fee": 8,
                      "v": 9,
                      "crbt": null,
                      "cf": "",
                      "al": {
                          "id": 74266151,
                          "name": "BLACKPINK IN YOUR AREA",
                          "picUrl": "http://p3.music.126.net/yKysEblB7-HOVrUCjvRhqw==/109951163678530141.jpg",
                          "tns": [],
                          "pic_str": "109951163678530141",
                          "pic": 109951163678530140
                      },
                      "dt": 230760,
                      "h": {
                          "br": 320000,
                          "fid": 0,
                          "size": 9232762,
                          "vd": -43590
                      },
                      "m": {
                          "br": 192000,
                          "fid": 0,
                          "size": 5539675,
                          "vd": -43590
                      },
                      "l": {
                          "br": 128000,
                          "fid": 0,
                          "size": 3693131,
                          "vd": -43590
                      },
                      "a": null,
                      "cd": "1",
                      "no": 4,
                      "rtUrl": null,
                      "ftype": 0,
                      "rtUrls": [],
                      "djId": 0,
                      "copyright": 0,
                      "s_id": 0,
                      "rtype": 0,
                      "rurl": null,
                      "mst": 9,
                      "cp": 457010,
                      "mv": 0,
                      "publishTime": 1542902400000,
                      "privilege": {
                          "id": 1325711421,
                          "fee": 8,
                          "payed": 0,
                          "st": 0,
                          "pl": 128000,
                          "dl": 0,
                          "sp": 7,
                          "cp": 1,
                          "subp": 1,
                          "cs": false,
                          "maxbr": 999000,
                          "fl": 128000,
                          "toast": false,
                          "flag": 5,
                          "preSell": false
                      }
                  }
              ],
              "relatedInfo": null,
              "videoUserLiveInfo": null,
              "vid": "4A378F3FF92F2D98C41C14B676276533",
              "durationms": 232827,
              "playTime": 210865,
              "praisedCount": 1687,
              "praised": false,
              "subscribed": false
          }
      },
      {
          "type": 1,
          "displayed": false,
          "alg": "onlineHotGroup",
          "extAlg": null,
          "data": {
              "alg": "onlineHotGroup",
              "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
              "threadId": "R_VI_62_1D0CD15C695BDA3532F04DF43D1968EE",
              "coverUrl": "https://p1.music.126.net/F8AvtPSfVQJmC1GW8YPs_w==/109951163599276825.jpg",
              "height": 720,
              "width": 1280,
              "title": "别错过~五月天与家家现场演唱如烟+如果还有明天",
              "description": "一首歌的时间，走过百转千回生死枯荣，听遍繁花绽放与凋零枯萎，阴晴又圆缺，转瞬间又走过了生命的无常岁月。",
              "commentCount": 87,
              "shareCount": 860,
              "resolutions": [
                  {
                      "resolution": 240,
                      "size": 32315058
                  },
                  {
                      "resolution": 480,
                      "size": 52937652
                  },
                  {
                      "resolution": 720,
                      "size": 80639319
                  }
              ],
              "creator": {
                  "defaultAvatar": false,
                  "province": 110000,
                  "authStatus": 0,
                  "followed": false,
                  "avatarUrl": "http://p1.music.126.net/rZNOiAnuGYjmYp4gB_TrRw==/109951163422607416.jpg",
                  "accountStatus": 0,
                  "gender": 2,
                  "city": 110101,
                  "birthday": 946656000000,
                  "userId": 1332536692,
                  "userType": 0,
                  "nickname": "芒果芋圆仙草冻",
                  "signature": "米娜桑，一起听歌吧~(*╹▽╹*)",
                  "description": "",
                  "detailDescription": "",
                  "avatarImgId": 109951163422607420,
                  "backgroundImgId": 109951162868128400,
                  "backgroundUrl": "http://p1.music.126.net/2zSNIqTcpHL2jIvU6hG0EA==/109951162868128395.jpg",
                  "authority": 0,
                  "mutual": false,
                  "expertTags": null,
                  "experts": {
                      "1": "音乐视频达人"
                  },
                  "djStatus": 0,
                  "vipType": 0,
                  "remarkName": null,
                  "avatarImgIdStr": "109951163422607416",
                  "backgroundImgIdStr": "109951162868128395"
              },
              "urlInfo": null,
              "videoGroup": [
                  {
                      "id": 58100,
                      "name": "现场",
                      "alg": null
                  },
                  {
                      "id": 1100,
                      "name": "音乐现场",
                      "alg": null
                  },
                  {
                      "id": 5100,
                      "name": "音乐",
                      "alg": null
                  },
                  {
                      "id": 24140,
                      "name": "五月天",
                      "alg": null
                  }
              ],
              "previewUrl": "http://vodkgeyttp9.vod.126.net/vodkgeyttp8/preview_1985558016_M6z8uLVw.webp?wsSecret=7e5d515f0f2a8367eeced93f30029984&wsTime=1677155205",
              "previewDurationms": 4000,
              "hasRelatedGameAd": false,
              "markTypes": null,
              "relateSong": [
                  {
                      "name": "伦桑-如烟",
                      "id": 1302093683,
                      "pst": 0,
                      "t": 0,
                      "ar": [
                          {
                              "id": 981141,
                              "name": "伦桑",
                              "tns": [],
                              "alias": []
                          }
                      ],
                      "alia": [],
                      "pop": 70,
                      "st": 0,
                      "rt": null,
                      "fee": 8,
                      "v": 20,
                      "crbt": null,
                      "cf": "",
                      "al": {
                          "id": 72321632,
                          "name": "如烟",
                          "picUrl": "http://p3.music.126.net/ipmWdSwSqj3wsPUr32eGWg==/109951167148121906.jpg",
                          "tns": [],
                          "pic_str": "109951167148121906",
                          "pic": 109951167148121900
                      },
                      "dt": 315559,
                      "h": {
                          "br": 320000,
                          "fid": 0,
                          "size": 12624501,
                          "vd": -16359
                      },
                      "m": {
                          "br": 192000,
                          "fid": 0,
                          "size": 7574718,
                          "vd": -13562
                      },
                      "l": {
                          "br": 128000,
                          "fid": 0,
                          "size": 5049826,
                          "vd": -11520
                      },
                      "a": null,
                      "cd": "01",
                      "no": 1,
                      "rtUrl": null,
                      "ftype": 0,
                      "rtUrls": [],
                      "djId": 0,
                      "copyright": 1,
                      "s_id": 0,
                      "rtype": 0,
                      "rurl": null,
                      "mst": 9,
                      "cp": 743010,
                      "mv": 0,
                      "publishTime": 1534348800000,
                      "privilege": {
                          "id": 1302093683,
                          "fee": 8,
                          "payed": 0,
                          "st": 0,
                          "pl": 128000,
                          "dl": 0,
                          "sp": 7,
                          "cp": 1,
                          "subp": 1,
                          "cs": false,
                          "maxbr": 999000,
                          "fl": 128000,
                          "toast": false,
                          "flag": 261,
                          "preSell": false
                      }
                  },
                  {
                      "name": "如果还有明天",
                      "id": 27906894,
                      "pst": 0,
                      "t": 0,
                      "ar": [
                          {
                              "id": 13283,
                              "name": "信乐团",
                              "tns": [],
                              "alias": []
                          }
                      ],
                      "alia": [],
                      "pop": 90,
                      "st": 0,
                      "rt": "",
                      "fee": 0,
                      "v": 689,
                      "crbt": null,
                      "cf": "",
                      "al": {
                          "id": 2693056,
                          "name": "热门华语94",
                          "picUrl": "http://p4.music.126.net/cpoUinrExafBHL5Nv5iDHQ==/109951166361218466.jpg",
                          "tns": [],
                          "pic_str": "109951166361218466",
                          "pic": 109951166361218460
                      },
                      "dt": 339000,
                      "h": {
                          "br": 320000,
                          "fid": 0,
                          "size": 13595337,
                          "vd": -61531
                      },
                      "m": {
                          "br": 192000,
                          "fid": 0,
                          "size": 8157270,
                          "vd": -61531
                      },
                      "l": {
                          "br": 128000,
                          "fid": 0,
                          "size": 5438237,
                          "vd": -61531
                      },
                      "a": null,
                      "cd": "1",
                      "no": 1,
                      "rtUrl": null,
                      "ftype": 0,
                      "rtUrls": [],
                      "djId": 0,
                      "copyright": 2,
                      "s_id": 0,
                      "rtype": 0,
                      "rurl": null,
                      "mst": 9,
                      "cp": 489015,
                      "mv": 0,
                      "publishTime": 1356969600004,
                      "privilege": {
                          "id": 27906894,
                          "fee": 0,
                          "payed": 0,
                          "st": 0,
                          "pl": 320000,
                          "dl": 320000,
                          "sp": 7,
                          "cp": 1,
                          "subp": 1,
                          "cs": false,
                          "maxbr": 320000,
                          "fl": 320000,
                          "toast": false,
                          "flag": 257,
                          "preSell": false
                      }
                  }
              ],
              "relatedInfo": null,
              "videoUserLiveInfo": null,
              "vid": "1D0CD15C695BDA3532F04DF43D1968EE",
              "durationms": 374378,
              "playTime": 190274,
              "praisedCount": 1209,
              "praised": false,
              "subscribed": false
          }
      },
      {
          "type": 1,
          "displayed": false,
          "alg": "onlineHotGroup",
          "extAlg": null,
          "data": {
              "alg": "onlineHotGroup",
              "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
              "threadId": "R_VI_62_4EF62DD383A385350F9A36A1FC4FF385",
              "coverUrl": "https://p2.music.126.net/LAum7JrP__InIQVPmpsorg==/109951164000834228.jpg",
              "height": 720,
              "width": 1280,
              "title": "加州旅馆--韩国第8届原声吉他大赛冠军",
              "description": "第8届原声吉他大赛是庆祝的表演舞台。老鹰队 - 加利福尼亚酒店是由思域城堡（Civic Castle）参加的最近七场比赛的冠军。",
              "commentCount": 1181,
              "shareCount": 4139,
              "resolutions": [
                  {
                      "resolution": 240,
                      "size": 35796737
                  },
                  {
                      "resolution": 480,
                      "size": 52613411
                  },
                  {
                      "resolution": 720,
                      "size": 81014149
                  }
              ],
              "creator": {
                  "defaultAvatar": false,
                  "province": 1000000,
                  "authStatus": 0,
                  "followed": false,
                  "avatarUrl": "http://p1.music.126.net/5bUa44UseCeYd_LLfuZUgQ==/109951168162159853.jpg",
                  "accountStatus": 0,
                  "gender": 1,
                  "city": 1000500,
                  "birthday": -599731200000,
                  "userId": 61201488,
                  "userType": 0,
                  "nickname": "张麻zier",
                  "signature": "我就是江湖上人见人爱.花见花开.车见车载，人称上天入地.无所不能.英俊潇洒.风流倜傥.玉树临风.学富五车.高大威猛.拥有千万‘粉丝’.迷倒万千少女，号称一朵梨花压海棠的玉面小白龙，帅到掉榨！",
                  "description": "",
                  "detailDescription": "",
                  "avatarImgId": 109951168162159860,
                  "backgroundImgId": 109951163314624220,
                  "backgroundUrl": "http://p1.music.126.net/w5F6JoNPA4c5Pbrn610Ocg==/109951163314624232.jpg",
                  "authority": 0,
                  "mutual": false,
                  "expertTags": null,
                  "experts": null,
                  "djStatus": 10,
                  "vipType": 11,
                  "remarkName": null,
                  "avatarImgIdStr": "109951168162159853",
                  "backgroundImgIdStr": "109951163314624232"
              },
              "urlInfo": null,
              "videoGroup": [
                  {
                      "id": 58100,
                      "name": "现场",
                      "alg": null
                  },
                  {
                      "id": 9100,
                      "name": "指弹",
                      "alg": null
                  },
                  {
                      "id": 4103,
                      "name": "演奏",
                      "alg": null
                  },
                  {
                      "id": 1100,
                      "name": "音乐现场",
                      "alg": null
                  },
                  {
                      "id": 5100,
                      "name": "音乐",
                      "alg": null
                  },
                  {
                      "id": 23128,
                      "name": "纯音乐",
                      "alg": null
                  },
                  {
                      "id": 16170,
                      "name": "吉他",
                      "alg": null
                  }
              ],
              "previewUrl": "http://vodkgeyttp9.vod.126.net/vodkgeyttp8/preview_2443580062_SAQUF9RS.webp?wsSecret=a286fc4491e8191c2f0c705db5c6764e&wsTime=1677155205",
              "previewDurationms": 4000,
              "hasRelatedGameAd": false,
              "markTypes": null,
              "relateSong": [
                  {
                      "name": "Hotel California (2013 Remaster)",
                      "id": 26289183,
                      "pst": 0,
                      "t": 0,
                      "ar": [
                          {
                              "id": 91725,
                              "name": "Eagles",
                              "tns": [],
                              "alias": []
                          }
                      ],
                      "alia": [],
                      "pop": 100,
                      "st": 0,
                      "rt": "600902000005872969",
                      "fee": 1,
                      "v": 121,
                      "crbt": null,
                      "cf": "",
                      "al": {
                          "id": 2446101,
                          "name": "The Studio Albums 1972-1979 (2013 Remaster)",
                          "picUrl": "http://p3.music.126.net/m_HGFCoSwhJYcJjgVaiq7A==/109951165261316702.jpg",
                          "tns": [],
                          "pic_str": "109951165261316702",
                          "pic": 109951165261316700
                      },
                      "dt": 391376,
                      "h": {
                          "br": 320000,
                          "fid": 0,
                          "size": 15657840,
                          "vd": -15499
                      },
                      "m": {
                          "br": 192000,
                          "fid": 0,
                          "size": 9394721,
                          "vd": -12991
                      },
                      "l": {
                          "br": 128000,
                          "fid": 0,
                          "size": 6263162,
                          "vd": -11381
                      },
                      "a": null,
                      "cd": "05",
                      "no": 1,
                      "rtUrl": null,
                      "ftype": 0,
                      "rtUrls": [],
                      "djId": 0,
                      "copyright": 1,
                      "s_id": 0,
                      "rtype": 0,
                      "rurl": null,
                      "mst": 9,
                      "cp": 7002,
                      "mv": 5343131,
                      "publishTime": 1369065600000,
                      "tns": [
                          "加州旅馆"
                      ],
                      "privilege": {
                          "id": 26289183,
                          "fee": 1,
                          "payed": 0,
                          "st": 0,
                          "pl": 0,
                          "dl": 0,
                          "sp": 0,
                          "cp": 0,
                          "subp": 0,
                          "cs": false,
                          "maxbr": 999000,
                          "fl": 0,
                          "toast": false,
                          "flag": 4,
                          "preSell": false
                      }
                  }
              ],
              "relatedInfo": null,
              "videoUserLiveInfo": null,
              "vid": "4EF62DD383A385350F9A36A1FC4FF385",
              "durationms": 397700,
              "playTime": 1403240,
              "praisedCount": 10542,
              "praised": false,
              "subscribed": false
          }
      },
      {
          "type": 1,
          "displayed": false,
          "alg": "onlineHotGroup",
          "extAlg": null,
          "data": {
              "alg": "onlineHotGroup",
              "scm": "1.music-video-timeline.video_timeline.video.181017.-295043608",
              "threadId": "R_VI_62_B12B9A318CBD8809ECB800F65D26A7B0",
              "coverUrl": "https://p2.music.126.net/yo7vup_quw-PIiHy1tPWdw==/109951166788411637.jpg",
              "height": 310,
              "width": 640,
              "title": "乌兹别克斯坦单曲UZBEK Shahzoda ft SHahzod-Muhabbatim",
              "description": null,
              "commentCount": 55,
              "shareCount": 1424,
              "resolutions": [
                  {
                      "resolution": 240,
                      "size": 11893481
                  }
              ],
              "creator": {
                  "defaultAvatar": false,
                  "province": 1000000,
                  "authStatus": 0,
                  "followed": false,
                  "avatarUrl": "http://p1.music.126.net/Icl5IulnHCZ0XFP6S3oa7Q==/109951164095453746.jpg",
                  "accountStatus": 0,
                  "gender": 1,
                  "city": 1002000,
                  "birthday": 829152000000,
                  "userId": 91740214,
                  "userType": 200,
                  "nickname": "Esmayil-0770",
                  "signature": "💙 ∞💜乌兹别克精选歌曲和mv {Uzbek}♫",
                  "description": "",
                  "detailDescription": "",
                  "avatarImgId": 109951164095453740,
                  "backgroundImgId": 109951164095470380,
                  "backgroundUrl": "http://p1.music.126.net/piHqJs0VVCNAk0LCUrmmSQ==/109951164095470388.jpg",
                  "authority": 0,
                  "mutual": false,
                  "expertTags": [
                      "民族"
                  ],
                  "experts": null,
                  "djStatus": 10,
                  "vipType": 11,
                  "remarkName": null,
                  "avatarImgIdStr": "109951164095453746",
                  "backgroundImgIdStr": "109951164095470388"
              },
              "urlInfo": null,
              "videoGroup": [
                  {
                      "id": 58100,
                      "name": "现场",
                      "alg": null
                  },
                  {
                      "id": 57106,
                      "name": "欧美现场",
                      "alg": null
                  },
                  {
                      "id": 57108,
                      "name": "流行现场",
                      "alg": null
                  },
                  {
                      "id": 1100,
                      "name": "音乐现场",
                      "alg": null
                  },
                  {
                      "id": 5100,
                      "name": "音乐",
                      "alg": null
                  },
                  {
                      "id": 14137,
                      "name": "感动",
                      "alg": null
                  }
              ],
              "previewUrl": null,
              "previewDurationms": 0,
              "hasRelatedGameAd": false,
              "markTypes": [
                  109
              ],
              "relateSong": [],
              "relatedInfo": null,
              "videoUserLiveInfo": null,
              "vid": "B12B9A318CBD8809ECB800F65D26A7B0",
              "durationms": 239521,
              "playTime": 138548,
              "praisedCount": 734,
              "praised": false,
              "subscribed": false
          }
      }
    ];
    let videoList = this.data.videoList;
     // 将视频最新的数据更新原有视频列表数据中
    videoList.push(...newVideoList)
    this.setData({
      videoList
    })
  
  },

  //跳转至搜索界面
  toSearch(){{
    wx.navigateTo({
      url: '/pages/search/search',
    })
  }},
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {
    console.log('页面下拉刷新');
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {
    console.log('页面上啦触底');
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage({from}) {
    console.log(from);
    if(from === 'button'){
        return{
            title:'来自button的转发',
            page:'/pages/video/video',
            imageUrl:'/static/images/nvsheng.jpg'
        }
    }else{
        return{
            title:'来自menu的转发',
            page:'/pages/video/video',
            imageUrl:'/static/images/nvsheng.jpg'
        }
    }
  
  }
})